package VentPpl;


import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Panel;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;

import componentes.Login;
import componentes.panelconfondo;

import Panels.PanelPeliculaEdit;
import Panels.PanelUser;







@SuppressWarnings("serial")
public class VentanaPrincipal extends JFrame {

	GridBagConstraints gbc;
	JTabbedPane panelusuario;
	JTabbedPane fichas;
	JPanel panel;
	/** The frame. */
	JFrame frame;
	JMenuBar menuBar;
	public static Login obj_login;

	public VentanaPrincipal(){		
		this.setIconImage (new ImageIcon(getClass().getResource("/recursos/minicines.png/")).getImage()); 
		
		this.setSize(800,600);
		//this.setExtendedState(MAXIMIZED_BOTH);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setTitle("MiniCines SA");
        this.setLayout(new BorderLayout());     
        this.setVisible(true);

         panel = new paneldefondo(); 
         this.add(panel);
         obj_login = new Login(this);
        this.panel.setVisible(false);
        menuBar = new MenuPrincipal();
        this.setJMenuBar(((MenuPrincipal) menuBar).getmenu());  
        this.setLayout(new GridBagLayout());
		
		 gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1,
				GridBagConstraints.FIRST_LINE_START, GridBagConstraints.BOTH, new Insets(
						5, 5, 5, 5), 0, 0);
       
       fichas = new JTabbedPane();
       panelusuario = new JTabbedPane();
       panelusuario.addTab("user",null,new PanelUser(),"Opciones usuario");
       this.add(fichas);
       this.add(panelusuario,gbc);
       
       gbc = new GridBagConstraints(1, 0, 3, 1, 1000, 10000,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
						5, 5, 5, 5), 0, 0);
       this.add(fichas,gbc);
       
       panelusuario.updateUI();

	}
	public JTabbedPane getFichas(){
		return fichas;
	}
	
	public JTabbedPane getControl(){
		return panelusuario;
	}
	
	public void addFicha(String nombre, JPanel ficha,String tip){
		this.fichas.addTab(nombre,null,ficha,tip);
	}
	
	public void addControl(String nombre, JPanel ficha){
		this.panelusuario.add(nombre,ficha);
	}
	
}
